<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF8">
        <title>X</title>
    </head>
    <body>
<?php

$fp = fopen("image_music", "r");
$data = array();
$cur = $_GET["q"];

while (!feof($fp)) {
    list ($image, $theme) = fscanf($fp, "%s %s");
    $data[$image] = $theme;
    if ($cur == "") {
        echo "<a href = \"index?q=$image\">$image</a>";
        echo "<br>";
    }
}
fclose($fp);


if ($cur != "") {
    echo "<div style='position: relative;'>";
    echo "<table width='100%' class='ts'>";
    echo "<tbody>";
    for ($i = 1; $i <= 20; $i++) {
        echo "<td align='center' width='20%' style='padding-top: 16px;'>
            <img src='thumbnails/$cur/$i'>";
        if ($i % 5 == 0) {
            echo "<tr>";
        }
        
    }
    echo "</tbody>";
    echo "</table>";
    echo "<center>";
    echo "<br>";
    echo "<a href = 'http://allmusic.com/explore/theme/$data[$cur]/songs'>theme songs</a>";
    echo "</center>";
    echo "</div>";
}
?>
    </body>
</html>
